package com.util;
import java.io.IOException;
import java.sql.Timestamp;
/**
 *   工具类
 *   增加时间类型，使其好插入到Store表中
 */
import java.util.Date;

import com.po.Store;
import com.vo.StoreForm;
public class DataFormat {
	public static Store StoreFormat(StoreForm s){
		Store store=new Store();
		Timestamp time=new Timestamp(new Date().getTime());
		store.setArea(s.getArea());
		store.setCreate_time(time);
		store.setDiscount(s.getDiscount());
		store.setLocation(s.getLocation());
		store.setName(s.getName());
		try {
			String fileroot=FileUtil.fileUp(s);
			System.out.println(fileroot);
			store.setPhoto(fileroot);
			
		} catch (IOException e) {
			
			System.out.println("文件没有上传成功");
			e.printStackTrace();
		}
		store.setRent(s.getRent());
		store.setStatus(s.getStatus());
		store.setType(s.getType());
		store.setUsingState(s.getUsingState());
		
		return store;
	}
	

	
}
